<?php
namespace app\common\model;
use app\common\model\CommonModel;
use think\Db;

class Admin extends CommonModel
{
	/**
	* 添加账号信息
	*/
	public function serAdmin($data)
	{
		return $this->insertGetId($data);
	}
	/**
	* 获取账号列表
	*/
	public function getAdminList($where,$limit = 10,$page)
	{
	   $item = $this->where($where)->field("admin_id,account,shop_id,admin_type,nkname,phone,remarks,(case addtime when 0 then 0 else FROM_UNIXTIME(addtime,'%Y-%m-%d %H:%i:%s') end) as addtime")->paginate($limit,false,['page'=>$page]);
       return empty($item) ? array():$item->toArray();
	}
	/**
	* 获取账号信息
	*/
	public function adminField($where,$field)
	{
		return $this->where($where)->value($field);
	}
	/**
	* 删除账号信息
	*/
	public function delAdmin($where)
	{
		return $this->where($where)->delete();
	}
	/**
	* 修改账号信息
	*/
	public function updateAdmin($where,$data)
	{
		return $this->where($where)->update($data);
	}
}
